const fs = require('fs');
const path = require('path');
const ExportHtml = require('./src/muya/lib/utils/exportHtml').default;

// 读取测试文件
const markdown = fs.readFileSync(path.join(__dirname, 'test-mermaid-export.md'), 'utf8');

// 创建ExportHtml实例
const exportHtml = new ExportHtml(markdown, null);

// 生成HTML
exportHtml.generate({ 
  printOptimization: false, 
  toc: null, 
  title: 'Test', 
  extraCss: '' 
}).then(html => {
  // 将生成的HTML写入文件供检查
  fs.writeFileSync(path.join(__dirname, 'exported-test.html'), html, 'utf8');
  console.log('HTML exported to exported-test.html');
  
  // 检查是否包含mermaid相关的SVG内容
  if (html.includes('<svg') && html.includes('mermaid')) {
    console.log('Mermaid图表已成功渲染为SVG');
  } else {
    console.log('Mermaid图表未正确渲染');
  }
}).catch(err => {
  console.error('导出过程中出错:', err);
});
